home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / inn1.000 / inn1.4sec-linux-src.tar / inn / lib / genid.c < prev    next >
C/C++ Source or Header  |  1993-01-29  |  721b  |  36 lines

  1. /*  $Revision: 1.3 $
  2. **
  3. */
  4. #include <stdio.h>
  5. #include <sys/types.h>
  6. #include "configdata.h"
  7. #if    defined(DO_NEED_TIME)
  8. #include <time.h>
  9. #endif    /* defined(DO_NEED_TIME) */
  10. #include <sys/time.h>
  11. #include "clibrary.h"
  12. #include "libinn.h"
  13.  
  14.  
  15. /* Scale time back a bit, for shorter Message-ID's. */
  16. #define OFFSET    673416000L
  17.  
  18. char *
  19. GenerateMessageID()
  20. {
  21.     static char        buff[SMBUF];
  22.     char        *p;
  23.     char        sec32[10];
  24.     char        pid32[10];
  25.     TIMEINFO        Now;
  26.  
  27.     if (GetTimeInfo(&Now) < 0)
  28.     return NULL;
  29.     Radix32((unsigned long)Now.time - OFFSET, sec32);
  30.     Radix32((unsigned long)getpid(), pid32);
  31.     if ((p = GetFQDN()) == NULL)
  32.     return NULL;
  33.     (void)sprintf(buff, "<%s$%s@%s>", sec32, pid32, p);
  34.     return buff;
  35. }
  36.